package com.usian.goods.mapper;
import com.usian.model.goods.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author wyp
 * @since 2024-12-17
 */
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {

    @Update("update goods set status=1 where id = #{id}")
    void shangGoods(@Param("id") Integer id);

    @Update("update goods set status=2 where id = #{id}")
    void xiaGoods(@Param("id") Integer id);

    @Update("update goods set nums = nums + #{numbers} where goods_id = #{id}")
    int findScoreId(@Param("id") String id,@Param("numbers") Integer numbers);

    @Select("select * from goods where tid = #{tid}")
    List<Goods> findGoodsByType(@Param("tid") Integer tid);


    List<Goods> findGoods();
}
